import {Component, OnInit, ViewEncapsulation} from '@angular/core';
import {AppService} from "../../../app.service";
import {ActivatedRoute} from "@angular/router";
import {FormComponent} from "./form/form.component";
import {FieldComponent} from "./field/field.component";

@Component({
  selector: 'ss-tables-publish',
  templateUrl: './publish.component.html',
  styleUrls: ['./publish.component.scss'],
  host: {class: "ss-tables-publish-wraper"},
  encapsulation: ViewEncapsulation.None
})
export class PublishComponent implements OnInit {

  action: string = "field";
  isEditTitle: boolean = false;
  // 动态组件
  dynamic: any = {
    "field": FieldComponent,
    "form": FormComponent
  }
  fields = [
    {fieldId: '1001', type: 'text', name: '姓名'},
    {fieldId: '1002', type: 'text', name: '性别'},
    {fieldId: '1003', type: 'number', name: '年龄'}
  ];
  layouts = [/*[1001]*/];

  constructor(private $app: AppService, private activatedRoute: ActivatedRoute) {
    $app.header.setThirdNavigation("/spaces/1024/tables", $app.space.title, "手动创建表格");
    activatedRoute.params.subscribe(params => {
      this.action = params.action;
    })
    activatedRoute.queryParams.subscribe(queryParams => {
    });
  }

  ngOnInit(): void {
  }

}
